﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LoginForm
{
    public partial class PageThatRequiresLogin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = this.Request.Cookies["username"];

            if (cookie == null)
            {
                Server.Transfer("Login.aspx");
            }
            else
            {
                this.LabelLogin.Text = "You are logged in as " + cookie.Value;
            }
        }
    }
}